package cn.net.autocode.platform.workflow.dict;

import cn.net.autocode.core.bean.ResultT;
import cn.net.autocode.dbManager.Dao;
import cn.net.autocode.platform.customDict.CustomDict;
import cn.net.autocode.platform.customDict.CustomDictAnnotation;
import com.alibaba.fastjson2.JSONArray;
import com.alibaba.fastjson2.JSONObject;
import org.springframework.stereotype.Component;

@Component
@CustomDictAnnotation("wfStepAction")
public class WfStepAction implements CustomDict {
    private final Dao dao;

    public WfStepAction(Dao dao) {
        this.dao = dao;
    }

    @Override
    public ResultT query(JSONObject param) {
        JSONArray array = dao.queryJSONArray("select action_code value,action_name label,require_comment from autocode_wf_step_actions where wf_code=? and step_code=? order by sort_no",param.getString("wfCode"),param.getString("stepCode"));
        return ResultT.success(array);
    }
}
